package com.example.constant.common;

import lombok.extern.slf4j.Slf4j;

/**
 * @author LiYuhang
 * @version 0.1
 * @application
 * @Date 2020/9/23 9:52
 */
@Slf4j
public class GlobalConstant {
    public static long requestTime(Long start) {
        log.info("耗时：{}毫秒",start == null ? 0 : System.currentTimeMillis() - start);
        return start == null ? 0 : System.currentTimeMillis() - start;
    }
    /**
     * code为0：成功
     */
    public final static int SUCCESS = 0;

    /**
     * code为0：失败
     */
    public final static int FAIL = -1;

    /**
     * code为2 ： 系统出错
     */
    public final static int SYSTEM_ERROR = -2;

    /**
     * UNKNOWN_ACCOUNT_EXCEPTION异常
     */
    public static final String UNKNOWN_ACCOUNT_EXCEPTION = "帐号不存在，请核实后输入！";

    /**
     * ACCOUNT_EXCEPTION异常
     */
    public static final String ACCOUNT_EXCEPTION = "帐号或密码不正确！";

    /**
     * INCORRECT_CREDENTIALS_EXCEPTION异常
     */
    public static final String INCORRECT_CREDENTIALS_EXCEPTION = "密码不正确，请重新输入!";

    /**
     * 账户锁定
     */
    public static final String SHIRO_LOCK = "由于密码输入错误次数大于5次，帐号已经被锁定一小时！";

    /**
     * 会话超时
     */
    public static final String SESSION_TIME_OUT = "会话已超时，请重新登录！";

    public final static String LOGIN_COUNT = "login_count_";

    public final static String LOCK_KEY = "_lock";

    public final static String LOCK_VALUE = "LOCKED";

    public final static int PASSWORD_ERROR_TIMES = 5;

    /**
     * 操作日志
     */
    public final static long OPERATE_LOG = 1L;
    /**
     * 系统日志
     */
    public final static long SYSTEM_LOG = 2L;
    /**
     * 访问日志
     */
    public final static long ACCESS_LOG = 3L;

}
